import cv2
import matplotlib.pyplot as plt
image = cv2.imread('7.jpg')
hist0 = cv2.calcHist([image],[0],None,[256],[0,255])
hist1 = cv2.calcHist([image],[1],None,[256],[0,255])
hist2 = cv2.calcHist([image],[2],None,[256],[0,255])
plt.plot(hist0,color = 'b',linestyle = '-')
plt.plot(hist1,color = 'g',linestyle = ':')
plt.plot(hist2,color = 'r',linestyle = '-')
plt.show()